
package com.insigma.business.qrcode.soldier.service.impl;

import com.insigma.business.qrcode.common.service.SequenceGenerator;
import com.insigma.business.qrcode.soldier.dao.GovResourceDao;
import com.insigma.business.qrcode.soldier.dto.GovResourceBSearcher;
import com.insigma.business.qrcode.soldier.dto.SequenceNameConstant;
import com.insigma.business.qrcode.soldier.entity.GovResourceDO;
import com.insigma.business.qrcode.soldier.service.GovResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("govResourceService")
public class GovResourceServiceImpl implements GovResourceService {

    @Autowired(required = false)
    private GovResourceDao govResourceDao;
    @Autowired(required = false)
    private SequenceGenerator sequenceGenerator;

    
    @Override
    public List<GovResourceDO> search(final GovResourceBSearcher govResourceBSearcher) {
        return govResourceDao.search(govResourceBSearcher);
    }
   
    @Override
    public GovResourceDO get(final String id){
        return govResourceDao.get(id);
    }

    
    @Override
    public Integer insert(final GovResourceDO govResourceDO){
        govResourceDO.setId(sequenceGenerator.genKey(SequenceNameConstant.GOV_RESOURCE_ID));
        return govResourceDao.insert(govResourceDO);
    }

    
    @Override
    public Integer update(final GovResourceDO govResourceDO){
        return govResourceDao.update(govResourceDO);
    }

    
    @Override
    public Integer delete(final String id, final String modifierType, final String modifierId){
        return govResourceDao.delete(id,modifierType,modifierId);
    }

    @Override
    public GovResourceDO getByCode(String parentCode) {
        return govResourceDao.getByCode(parentCode);
    }

    @Override
    public List<GovResourceDO> listByRoleId(String roleId) {
        return govResourceDao.getResourcesByRoleId(roleId);
    }

    @Override
    public List<GovResourceDO> getByParentCode(String code) {
        return govResourceDao.getByParentCode(code);
    }

}
